package com.bona.dao.system;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import com.bona.dao.common.BaseDao;
import com.bona.model.system.SysOrgModel;

public interface SysOrgDao extends BaseDao {
	
	/**
	 * 删除机构下
	 * 用户机构关联关系
	 * @param orgId
	 */
	@Delete("delete from sys_user_org where org_id=#{orgId}")
	public Integer deleteUserOrgByOrgId(@Param("orgId")String orgId);
	
	/**
	 * 删除机构下角色机构关联关系
	 * @param orgId
	 */
	@Delete("delete from sys_role_org where org_id=#{orgId}")
	public Integer deleteRoleOrgByOrgId(@Param("orgId")String orgId);
	
	/**
	 * 通过id删除机构信息
	 * @param id
	 * @return
	 */
	@Delete("delete from sys_org where id=#{id}")
	public Integer deleteById(@Param("id")String id);
	
	/**
	 * 通过机构编号获取机构
	 * @param ids
	 * @return
	 */
	public List<SysOrgModel> queryOrgByIds(List<String> ids);
	
	/**
	 * 获取最大机构代码
	 * @param orgCode
	 * @param localCodeLen
	 * map orgCode localCodeLen
	 * @return
	 */
	public String queryMaxOrgCode(String orgCode, int localCodeLen);
	
}
